Rick Richardson wrote:
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sat, 17 May 2003 19:30:21 +0000 (19:30 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sat, 17 May 2003 19:30:21 +0000 (19:30 +0000)
> This patch adds..
>
>     - fix for Makefile
>     - Teach geo.c how to read the <type> and stick it in icon_descr.
>       N.B. not sure I did this 100% right
>     - Teach gpsdrive.style how to output icon_descr as the "category".

gpsbabel/Makefile
gpsbabel/geo.c
gpsbabel/internal_styles.c
gpsbabel/reference/gl.loc
gpsbabel/reference/gpsdrive.txt
gpsbabel/style/gpsdrive.style

index ec7bcef8a2c7021c0689111849288c76c9932fea..d38a62f2f613b597840eb7b237af9cb44a50790e 100644 (file)
@@ -165,4 +165,4 @@ jeeps/gpsutil.o: jeeps/gpsutil.c jeeps/gps.h jeeps/gpsport.h \
   jeeps/gpsmath.h jeeps/gpsnmea.h jeeps/gpsmem.h jeeps/gpsrqst.h \
   jeeps/gpsinput.h jeeps/gpsproj.h jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h
 internal_styles.c: mkstyle.sh style/README.style style/csv.style style/custom.style style/dna.style style/fugawi.style style/gpsdrive.style style/gpsman.style style/mxf.style style/nima.style style/ozi.style style/s_and_t.style style/xmap.style style/xmapwpt.style
-       ./mkstyle.sh > $@ || rm -f $@ ; exit 1
+       ./mkstyle.sh > $@ || (rm -f $@ ; exit 1)
index 86dd7850bfc6e4fb5b72f1ef7cc71970958d1a8a..c3ff29c4c77e4b2e1f66664ce4f45909b14d6cf0 100644 (file)
 static int in_wpt;
 static int in_name;
 static int in_link;
+static int in_type;
 static int in_cdata;
 static char *cdatastr;
+static char *typestr;
 
 static XML_Parser psr;
 static waypoint *wpt_tmp;
@@ -65,6 +67,18 @@ tag_name(const char **attrv)
        }
 }
 
+static void
+tag_type(const char **attrv)
+{
+       const char **avp = &attrv[0];
+       while (*avp) { 
+               if (strcmp(avp[0], "type") == 0) {
+                       wpt_tmp->icon_descr = xstrdup(avp[1]);
+               }
+               avp+=2;
+       }
+}
+
 static void
 tag_link(const char **attrv)
 {
@@ -91,6 +105,9 @@ geo_start(void *data, const char *el, const char **attr)
                else if (strcmp(el, "coord") == 0) {
                        tag_coord(attr);
                }
+               else if (strcmp(el, "type") == 0) {
+                       tag_type(attr);
+               }
        }
 
        if (strcmp(el, "waypoint") == 0) {
@@ -98,6 +115,9 @@ geo_start(void *data, const char *el, const char **attr)
                in_wpt++;
        } else if (strcmp(el, "name") == 0) {
                in_name++;
+       } else if (strcmp(el, "type") == 0) {
+               tag_type(attr);
+               in_type++;
        } else if (strcmp(el, "link") == 0) {
                tag_link(attr);
                in_link++;
@@ -124,6 +144,11 @@ geo_end(void *data, const char *el)
        else if (strcmp(el, "name") == 0) {
                in_name--;
        }
+       else if (strcmp(el, "type") == 0) {
+               wpt_tmp->icon_descr = xstrdup(typestr);
+               memset(typestr,0, MY_CBUF);
+               in_type--;
+       }
        else if (strcmp(el, "link") == 0) {
                in_link--;
        }
@@ -138,6 +163,10 @@ geo_cdata(void *dta, const XML_Char *s, int len)
                memcpy(estr, s, len); 
                in_cdata++;
        }
+       if (in_type) {
+               estr = typestr + strlen(typestr);
+               memcpy(estr, s, len); 
+       }
 }
 
 void
@@ -155,6 +184,7 @@ geo_rd_init(const char *fname, const char *args)
 
        XML_SetElementHandler(psr, geo_start, geo_end);
        cdatastr = xcalloc(MY_CBUF,1);
+       typestr = xcalloc(MY_CBUF,1);
        XML_SetCharacterDataHandler(psr, geo_cdata);
 }
 
@@ -164,6 +194,9 @@ geo_rd_deinit(void)
        if ( cdatastr ) {
                xfree(cdatastr);
        }
+       if ( typestr ) {
+               xfree(typestr);
+       }
        fclose(fd);
 }
 
@@ -212,6 +245,9 @@ geo_waypt_pr(const waypoint *waypointp)
                waypointp->position.longitude.degrees);
        fprintf(ofd, "\n");
 
+       if (waypointp->icon_descr) {
+               fprintf(ofd, "<type>%s</type>\n", waypointp->icon_descr);
+       }
        if (waypointp->url) {
                fprintf(ofd, "<link text =\"Cache Details\">%s</link>\n", 
                        waypointp->url);
index b7334434fadd22c1cca494b943f1c54bcb727e7e..abb612bd8668207126eff0bc2c82c7dcca4e75b8 100644 (file)
@@ -163,10 +163,10 @@ static char gpsdrive[] =
 "#\n"
 "FIELD_DELIMITER               SPACE\n"
 "RECORD_DELIMITER      NEWLINE\n"
-"BADCHARS              ,\"\n"
+"BADCHARS              ,'\"\n"
 
-"SHORTLEN          20\n"
-"SHORTWHITE                0\n"
+"SHORTLEN              20\n"
+"SHORTWHITE              0\n"
 
 "#\n"
 "# INDIVIDUAL DATA FIELDS, IN ORDER OF APPEARANCE:\n"
@@ -174,10 +174,12 @@ static char gpsdrive[] =
 "IFIELD        SHORTNAME, \"\", \"%s\"\n"
 "IFIELD        LAT_DECIMAL, \"\", \"%08.5f\"\n"
 "IFIELD        LON_DECIMAL, \"\", \"%08.5f\"\n"
+"IFIELD        ICON_DESCR, \"\", \"%s\"\n"
 
 "OFIELD        ANYNAME, \"\", \"%s\"\n"
 "OFIELD        LAT_DECIMAL, \"\", \"%08.5f\"\n"
 "OFIELD        LON_DECIMAL, \"\", \"%08.5f\"\n"
+"OFIELD        ICON_DESCR, \"\", \"%s\"\n"
 ;
 static char gpsman[] = 
 "# gpsbabel XCSV style file\n"
index f514e8627b1dc05a6a7cfa4ba456612561ba1611..192d169f2dc16b4e7b7d2232723969a3eccfb5e0 100644 (file)
@@ -2,46 +2,55 @@
 <waypoint>
 <name id="GCEBB"><![CDATA[Mountain Bike Heaven by susy1313]]></name>
 <coord lat="35.972033" lon="-87.134700"/>
+<type>geocache</type>
 <link text ="Cache Details">http://www.geocaching.com/seek/cache_details.asp?ID=3771</link>
 </waypoint>
 <waypoint>
 <name id="GC1A37"><![CDATA[The Troll by a182pilot & Family]]></name>
 <coord lat="36.090683" lon="-86.679550"/>
+<type>geocache</type>
 <link text ="Cache Details">http://www.geocaching.com/seek/cache_details.asp?ID=6711</link>
 </waypoint>
 <waypoint>
 <name id="GC1C2B"><![CDATA[Dive Bomber by JoGPS & family]]></name>
 <coord lat="35.996267" lon="-86.620117"/>
+<type>geocache</type>
 <link text ="Cache Details">http://www.geocaching.com/seek/cache_details.asp?ID=7211</link>
 </waypoint>
 <waypoint>
 <name id="GC25A9"><![CDATA[FOSTER by JoGPS & Family]]></name>
 <coord lat="36.038483" lon="-86.648617"/>
+<type>geocache</type>
 <link text ="Cache Details">http://www.geocaching.com/seek/cache_details.asp?ID=9641</link>
 </waypoint>
 <waypoint>
 <name id="GC2723"><![CDATA[Logan Lighthouse by JoGps & Family]]></name>
 <coord lat="36.112183" lon="-86.741767"/>
+<type>geocache</type>
 <link text ="Cache Details">http://www.geocaching.com/seek/cache_details.asp?ID=10019</link>
 </waypoint>
 <waypoint>
 <name id="GC2B71"><![CDATA[Ganier Cache by Susy1313]]></name>
 <coord lat="36.064083" lon="-86.790517"/>
+<type>geocache</type>
 <link text ="Cache Details">http://www.geocaching.com/seek/cache_details.asp?ID=11121</link>
 </waypoint>
 <waypoint>
 <name id="GC309F"><![CDATA[Shy's Hill by FireFighterEng33]]></name>
 <coord lat="36.087767" lon="-86.809733"/>
+<type>geocache</type>
 <link text ="Cache Details">http://www.geocaching.com/seek/cache_details.asp?ID=12447</link>
 </waypoint>
 <waypoint>
 <name id="GC317A"><![CDATA[GittyUp by JoGPS / Warner Parks]]></name>
 <coord lat="36.057500" lon="-86.892000"/>
+<type>geocache</type>
 <link text ="Cache Details">http://www.geocaching.com/seek/cache_details.asp?ID=12666</link>
 </waypoint>
 <waypoint>
 <name id="GC317D"><![CDATA[Inlighting by JoGPS / Warner Parks]]></name>
 <coord lat="36.082800" lon="-86.867283"/>
+<type>geocache</type>
 <link text ="Cache Details">http://www.geocaching.com/seek/cache_details.asp?ID=12669</link>
 </waypoint>
 </loc>
index 65e18b8a8d595f66beedac3868ae173c67d54082..901eb1c849fbe0030f6ed2998faf3ee155936c53 100644 (file)
@@ -1,9 +1,9 @@
-GCEBB 35.97203 -87.13470
-GC1A37 36.09068 -86.67955
-GC1C2B 35.99627 -86.62012
-GC25A9 36.03848 -86.64862
-GC2723 36.11218 -86.74177
-GC2B71 36.06408 -86.79052
-GC309F 36.08777 -86.80973
-GC317A 36.05750 -86.89200
-GC317D 36.08280 -86.86728
+GCEBB 35.97203 -87.13470 geocache
+GC1A37 36.09068 -86.67955 geocache
+GC1C2B 35.99627 -86.62012 geocache
+GC25A9 36.03848 -86.64862 geocache
+GC2723 36.11218 -86.74177 geocache
+GC2B71 36.06408 -86.79052 geocache
+GC309F 36.08777 -86.80973 geocache
+GC317A 36.05750 -86.89200 geocache
+GC317D 36.08280 -86.86728 geocache
index 236c07595b4432d530235cd9ac874ae63ae0e36f..96cbda45fa9716e3613fdf7ec9580e03ecba4de3 100644 (file)
@@ -13,10 +13,10 @@ DESCRIPTION         GpsDrive Format
 #
 FIELD_DELIMITER                SPACE
 RECORD_DELIMITER       NEWLINE
-BADCHARS               ,"
+BADCHARS               ,'"
 
-SHORTLEN          20
-SHORTWHITE                0
+SHORTLEN               20
+SHORTWHITE              0
 
 #
 # INDIVIDUAL DATA FIELDS, IN ORDER OF APPEARANCE:
@@ -24,7 +24,9 @@ SHORTWHITE                0
 IFIELD SHORTNAME, "", "%s"
 IFIELD LAT_DECIMAL, "", "%08.5f"
 IFIELD LON_DECIMAL, "", "%08.5f"
+IFIELD ICON_DESCR, "", "%s"
 
 OFIELD ANYNAME, "", "%s"
 OFIELD LAT_DECIMAL, "", "%08.5f"
 OFIELD LON_DECIMAL, "", "%08.5f"
+OFIELD ICON_DESCR, "", "%s"